home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SunSoft Catalyst CDWARE 1996 May to August
/
Catalyst CDWARE 1996 May to August.iso
/
.products
/
.bin
/
httpd
/
Solaris_1
/
create_index.pl
< prev
next >
Wrap
Perl Script
|
1996-02-29
|
2KB
|
73 lines
#!./perl
# ------------------------------------------------------------
# create_index.pl, by Jean-Pierre Girard (jpg@corrado.sun.com)
# This edit in real-time the home page file
# necessary for the CDware.
# ------------------------------------------------------------
# Bugs and other fixes
# ------------------------------------------------------------
##############################################################################
# Main block
##############################################################################
if ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN, $request, $ENV{'CONTENT_LENGTH'});
} elsif ($ENV{'REQUEST_METHOD'} eq "GET" ) {
$request = $ENV{'QUERY_STRING'};
}
$~ = "HTMLHEADER";
write STDOUT;
#@names = &url_decode(split(/[&=]/, $request));
#%rqpairs = @names;
#$Products[1] = $rqpairs{"Product2"};
print "ARGV=$ARGV[0]<br>, request=$request<br>";
if ($ARGV[0] eq "HTML") {
} elsif ($request eq "") {
print "no request";
} else {
}
for $key (sort keys %ENV) {
print "$key=$ENV{$key}<br>";
}
$HomeDir = $request;
$HomeDir =~ s?.*/([^/]*)/[^/]*$?../\1?;
$ENV{"SCRIPT_NAME"}=$HomeDir;
$HomeDir = $request;
$HomeDir =~ s?(.*)/[^/]*$?\1?;
print "HomeDir=$HomeDir<br>";
exec("cd $HomeDir;echo \"Content-type: text/html\n\n\n<html><body>\";echo $HomeDir;cat $request");
print $ENV{"SCRIPT_NAME"}, "<br>, pwd=", `pwd`, "<br>";
$INDEXFILENAME=$request;
unless (open (INDEXFILE, "$INDEXFILENAME")) {
#&PrintErr("NoCreation", $INDEXFILENAME);
#print "<H3><dd><img ALIGN=middle src=\"file:///tmp/httpd/.products/CDware/images/error.gif\">Cannot create $INDEXFILENAME</H3></dd><br>";
} else {
while (<INDEXFILE>) {
print STDOUT $_;
}
}
################################################################################
# Define FORMATS (no more code)
################################################################################
format HTMLHEADER =
Content-type: text/html
<html>
<title>Developer's Kit</title>
<body>
.